<template>
    
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">

          <#assign x=0 />
            <#list formList as po> <#rt/>
            <#if x%viewModule.viewMaincols?number =0>
          <a-row></#if>
              <#assign x=x+1 />
            <a-col :span="${24/viewModule.viewMaincols?number}">
              <a-form-item
                  :labelCol="labelCol"
                  :wrapperCol="wrapperCol"
                  label="${po.uiFieldcomment}">
                  <#if po.uiUitype =='2'>
                      <a-date-picker style="width: 100%"  <#if po.uiOnlyread =='true'> disabled </#if>  format='YYYY-MM-DD' v-decorator="[ '${po.fieldName}', <#if po.uiNotnull =='true'||(po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode')>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                  <#elseif po.uiUitype =='7'>
                      <a-date-picker style="width: 100%" showTime <#if po.uiOnlyread =='true'> disabled </#if>  format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${po.fieldName}', <#if po.uiNotnull =='true'||(po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode')>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                  <#elseif po.uiUitype =='1' || po.uiUitype =='6'>
                      <a-select <#if po.uiOnlyread =='true'> disabled </#if>  v-decorator="[ '${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]">
                      </a-select>
                  <#elseif po.uiUitype =='4'>
                      <a-input-number style="width: 100%" <#if po.uiOnlyread =='true'> disabled </#if> v-decorator="[ '${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                  <#elseif po.uiUitype =='5'>
                      <a-textarea <#if po.uiOnlyread =='true'> disabled </#if> v-decorator="[ '${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" :autoSize="{ minRows: 2, maxRows: 4 }"/>
                  <#else>
                      <a-input <#if po.uiOnlyread =='true'> disabled </#if>  v-decorator="['${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                  </#if>
              </a-form-item>
           </a-col>
         <#if x%viewModule.viewMaincols?number =0 ></a-row></#if>
          </#list> 
         <#if formList?size % viewModule.viewMaincols?number !=0 ></a-row></#if>


          <!-- 子表单区域 -->
          <a-tabs defaultActiveKey="0" >
              <#list detailedTable as sub>
                  <a-tab-pane tab="${sub}" key="${sub_index}" :forceRender="true">
                      <div class="TableTile">
                          <a-row type="flex" class="TableRow" style="margin-bottom:10px">
                              <#list allColumns as po>
                                  <#if po.uiTable?replace("_"," ")?capitalize?replace(" ","")=='${sub}' && po.uiForm=='true'>
                                      <div <#if po.uiNotnull =='true'|| po.uiDefaultvalue !=''>class="addRedStar"</#if> style="width:150px"  >${po.uiFieldcomment}</div>
                                  </#if>
                              </#list>
                              <a-col style="width:180px">操作</a-col>
                          </a-row>

                          <a-row class="TableRow" type="flex" style="margin-bottom:10px" v-for="(item, index) in ${entityName?uncap_first}MainModel.${sub?uncap_first}List" :key="index">
                              <#list allColumns as po>
                                  <#if po.uiTable?replace("_"," ")?capitalize?replace(" ","")=='${sub}'  && po.uiForm=='true'>
                                      <a-col>
                                          <a-form-item>
                                              <#if po.uiUitype =='2'>
                                                  <a-date-picker style="width: 150px"  <#if po.uiOnlyread =='true'> disabled </#if>  format='YYYY-MM-DD' v-decorator="[ '${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||(po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode')>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                                              <#elseif po.uiUitype =='7'>
                                                  <a-date-picker style="width: 150px" showTime <#if po.uiOnlyread =='true'> disabled </#if>  format='YYYY-MM-DD HH:mm:ss' v-decorator="[ '${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||(po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode')>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                                              <#elseif po.uiUitype =='1' || po.uiUitype =='6'>
                                                  <a-select style="width: 150px"  <#if po.uiOnlyread =='true'> disabled </#if>  v-decorator="[ '${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]">
                                                  </a-select>
                                              <#elseif po.uiUitype =='4'>
                                                  <a-input-number style="width: 150px" <#if po.uiOnlyread =='true'> disabled </#if> v-decorator="[ '${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                                              <#elseif po.uiUitype =='5'>
                                                  <a-textarea style="width: 150px" <#if po.uiOnlyread =='true'> disabled </#if> v-decorator="[ '${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" :autoSize="{ minRows: 2, maxRows: 4 }"/>
                                              <#else>
                                                  <a-input style="width: 150px" <#if po.uiOnlyread =='true'> disabled </#if>  v-decorator="['${sub?uncap_first}List['+index+'].${po.fieldName}', <#if po.uiNotnull =='true'||po.uiDefaultvalue !=''>validatorRules.${po.fieldName} <#else>{}</#if>]" />
                                              </#if>
                                          </a-form-item>

                                      </a-col>

                                  </#if>
                              </#list>

                              <a-col style="width: 180px">
                                  <a-form-item>
                                      <a-button  icon="plus"></a-button>&nbsp;
                                      <a-button  icon="minus"></a-button>
                                  </a-form-item>
                              </a-col>
                          </a-row>
                      </div>
                  </a-tab-pane>
              </#list>

          </a-tabs>


      </a-form>
    </a-spin>
</template>

<script>

  export default {
    data () {
      return {
        title:"操作",
        visible: false,
          ${entityName?uncap_first}MainModel: {
              <#list detailedTable as sub>
              ${sub?uncap_first}List: [{}]<#if sub_has_next>,</#if>
              </#list>
          },

          labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },

        confirmLoading: false,
        form: this.$form.createForm(this),
        validatorRules:{
      <#list allColumns as po>
      <#if po.uiForm =='true'>
      <#if po.uiNotnull =='true'||(po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode')>
      ${po.fieldName}:{<#if po.uiNotnull =='true'> rules: [{ required: true, message: '请输入${po.uiFieldcomment}!' ,<#if po.uiExpression !=''>pattern:${po.uiExpression} </#if>}],</#if>
              <#if  po.uiDefaultvalue !=''&&po.uiDefaultvalue !='#date'&&po.uiDefaultvalue !='#user'&&po.uiDefaultvalue !='#orgCode'>initialValue: '${po.uiDefaultvalue}'</#if>},
      </#if>
      </#if>
      </#list>
    },
      }
    },
    created () {
    },
    methods: {



    }
  }
</script>

<style lang="less" scoped>
    .TableTile {
        height: 300px;
        width: 1024px;
        overflow: auto;
        background: #EEEEEE;
    }

    .TableRow {
        margin-bottom: 10px;
        width: 2024px;
        text-align: center;
    }

    .addRedStar:after {
        content: '*';
        color: red;
        font-size: 18px;
    }
</style>